class ReservadatahorariosController < ApplicationController
  # GET /reservadatahorarios
  # GET /reservadatahorarios.xml
  def index
    @reservae = Reserva.find(params[:id])
    @reservadatahorarios = Reservadatahorario.find(:all,:conditions=>["reserva_id = ?",@reservae.id])
     @reservadatahorario = Reservadatahorario.new
    respond_to do |format|
      format.html # index.html.erb
      format.xml  { render :xml => @reservadatahorarios }
    end
  end

  # GET /reservadatahorarios/1
  # GET /reservadatahorarios/1.xml
  def show
    @reservadatahorario = Reservadatahorario.find(params[:id])

    respond_to do |format|
      format.html # show.html.erb
      format.xml  { render :xml => @reservadatahorario }
    end
  end

  # GET /reservadatahorarios/new
  # GET /reservadatahorarios/new.xml
  def new
    @reservadatahorario = Reservadatahorario.new
    respond_to do |format|
      format.html # new.html.erb
      format.xml  { render :xml => @reservadatahorario }
    end
  end

  # GET /reservadatahorarios/1/edit
  def edit
    @reservadatahorario = Reservadatahorario.find(params[:id])
  end

  # POST /reservadatahorarios
  # POST /reservadatahorarios.xml
  def create
    @reservadatahorario = Reservadatahorario.new(params[:reservadatahorario])

    respond_to do |format|
      if @reservadatahorario.save
        format.html { redirect_to(@reservadatahorario, :notice => 'Reservadatahorario was successfully created.') }
        format.xml  { render :xml => @reservadatahorario, :status => :created, :location => @reservadatahorario }
      else
        format.html { render :action => "new" }
        format.xml  { render :xml => @reservadatahorario.errors, :status => :unprocessable_entity }
      end
    end
  end

  # PUT /reservadatahorarios/1
  # PUT /reservadatahorarios/1.xml
  def update
    @reservadatahorario = Reservadatahorario.find(params[:id])

    respond_to do |format|
      if @reservadatahorario.update_attributes(params[:reservadatahorario])
        format.html { redirect_to(@reservadatahorario, :notice => 'Reservadatahorario was successfully updated.') }
        format.xml  { head :ok }
      else
        format.html { render :action => "edit" }
        format.xml  { render :xml => @reservadatahorario.errors, :status => :unprocessable_entity }
      end
    end
  end

  # DELETE /reservadatahorarios/1
  # DELETE /reservadatahorarios/1.xml
  def destroy
    @reservadatahorario = Reservadatahorario.find(params[:id])
    @reservadatahorario.destroy

    respond_to do |format|
      format.html { redirect_to(reservadatahorarios_url) }
      format.xml  { head :ok }
    end
  end
end
